package com.augurit.wf.common.constant;

import java.util.List;

import org.hibernate.Session;
import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.WebApplicationContext;

import com.augurit.wf.common.dao.Jbpm4HistTaskDao;
import com.augurit.wf.jbpmex.task.multitask.MultiTaskDefinition;
import com.opensymphony.xwork2.ActionContext;

public class MsgConstant {

	public static final String MULTI_TASK_WAITTING = "处理完毕，正等待其他用户处理。";
	
	public static final String VALIDATE_ASSIGNEE_NULL = "校验参与者时出错，原因是没有任务实例ID或参与者或目标环节！";
	
	public static final String ONE_MAX = "下一环节用户数只能为1，但实际所选用户数为";
	
	public static final String NO_USER = "不存在任何用户";
	
	public static final String WF_END = "流程已执行完毕";
	
	public static final String NO_DEFAULT_TRANSITION = "无默认跳转";
	
	public static final String SELECT_NEXT_ACTIVITY_ASSIGNEES = "请点击“选择”按钮选择下一环节参与者。";
	
	public static final String SEND_TO_NEXT_ACTIVITY = "请点击“发送”按钮发送到所选环节。";
	
	

	public static String getNextTaskMsg(TaskDefinitionImpl taskDefinition){
		if(taskDefinition != null){
			String assigneeRange = taskDefinition.getAssigneeRange();
			MultiTaskDefinition multiTask = taskDefinition.getMultiTaskDefinition();
			
			if(multiTask != null && multiTask.isEnableMultiTask()){
				if(assigneeRange != null && assigneeRange.trim().length() > 0)
					return "所选下一环节为多人审批模式，请选择多个参与者。";
				else
					return "所选下一环节为多人审批模式，请设置发送选项。";
			}else{
				if(assigneeRange != null && assigneeRange.trim().length() > 0)
					return "请选择一个参与者。";
				else
					return "请设置发送选项。";
			}
		}
		return "";
	}
	
	public static String getSendSuccessMsg(String destActivityChineseName, String assigneeNames){
		String result = "";
		
		if(destActivityChineseName != null){
			result = "流程已转发至&nbsp;<font color=\"black\">"+ destActivityChineseName +"</font>&nbsp;环节";
			
			if(assigneeNames != null && assigneeNames.trim().length() > 0){
				result += "，下一环节参与者为：<font color=\"black\">" + assigneeNames +"</font>。";
			}
		}
		
		return result;
	}

}
